- diff = diff_file.diff
- file_raw_path = namespace_project_raw_path(@project.namespace, @project, tree_join(@commit.id, diff.new_path))
// diff_refs will be nil for orphaned commits (e.g. first commit in repo)
- if diff_refs
  - old_commit_id = diff_refs.first.id
  - old_file_raw_path = namespace_project_raw_path(@project.namespace, @project, tree_join(old_commit_id, diff.old_path))

- if diff.renamed_file || diff.new_file || diff.deleted_file
  .image
    %span.wrap
      .frame{class: image_diff_class(diff)}
        %img{src: diff.deleted_file ? old_file_raw_path : file_raw_path}
      %p.image-info= "#{number_to_human_size file.size}"
- else
  .image
    %div.two-up.view
      %span.wrap
        .frame.deleted
          %a{href: namespace_project_blob_path(@project.namespace, @project, tree_join(old_commit_id, diff.old_path))}
            %img{src: old_file_raw_path}
        %p.image-info.hide
          %span.meta-filesize= "#{number_to_human_size old_file.size}"
          |
          %b 宽:
          %span.meta-width
          |
          %b 高:
          %span.meta-height
      %span.wrap
        .frame.added
          %a{href: namespace_project_blob_path(@project.namespace, @project, tree_join(@commit.id, diff.new_path))}
            %img{src: file_raw_path}
        %p.image-info.hide
          %span.meta-filesize= "#{number_to_human_size file.size}"
          |
          %b 宽:
          %span.meta-width
          |
          %b 高:
          %span.meta-height

    %div.swipe.view.hide
      .swipe-frame
        .frame.deleted
          %img{src: old_file_raw_path}
        .swipe-wrap
          .frame.added
            %img{src: file_raw_path}
        %span.swipe-bar
          %span.top-handle
          %span.bottom-handle

    %div.onion-skin.view.hide
      .onion-skin-frame
        .frame.deleted
          %img{src: old_file_raw_path}
        .frame.added
          %img{src: file_raw_path}
        .controls
          .transparent
          .drag-track
            .dragger{:style => "left: 0px;"}
          .opaque


  .view-modes.hide
    %ul.view-modes-menu
      %li.two-up{data: {mode: 'two-up'}} 两方对比
      %li.swipe{data: {mode: 'swipe'}} 交换覆盖
      %li.onion-skin{data: {mode: 'onion-skin'}} 透明覆盖
